/**
 * A possible solution. It is a right one if you specify a target node.
 * If you do not, it is a wrong answer.
 */
public class Solution {
    private GameNode targetNode;
    private String sourceFile;
    private String solutionText;
    private int malus = 0; 

    Solution(String solText, GameNode tarNode) {
		this(solText, tarNode, null, 0);
    }

    Solution(String solText, GameNode tarNode, String sourceFile, int malus) {
		this.targetNode = tarNode;
		this.solutionText = solText;
		this.malus = malus;
		this.sourceFile = sourceFile;
    }
	
    Solution(String solText) {
		this(solText, null, 0);
    }
	
    Solution(String solText, String sourceFile){
		this(solText, null, sourceFile, 0);
    }
	
    Solution(String solText, String sourceFile, int malus){
		this(solText, null, sourceFile, malus);
    }
	
    Solution(String solText, int malus) {
		this(solText, null, null, malus);
    }

    Solution(String solText, String sourceFile, GameNode tarNode){
		this(solText, tarNode, sourceFile, 0);
    }
    
    /*
     * The node to which this solutions links.
     * This is null for wrong answers.
     */
    public GameNode getTargetNode() {
		return this.targetNode;
    }
    
    public void setTargetNode(GameNode targetNode) {
		this.targetNode = targetNode;
	}
    
    /*
     * Returns the text version of this solution. For picture solutions it
     * is an alternative text.
     */
    public String toString() {
		return solutionText;
    }
    
    /*
     * Set this to a value higher than 0 for wrong answers.
     */
    public void setMalus(int malus) {
		this.malus = malus;
    }
    
    /*
     * The node's reachable score should be decreased by this when this
     * solution is chosen. A right answer should return 0 here.
     */
    public int getMalus() {
		return malus;
    }
	
    /*
     * This String contains the filename of a media file like a picture.
     * It could be null if there is nothing like this for this solution.
     */
    public String getSourceFile() {
		return this.sourceFile;
    }
    
    public void setSourceFile(String sourceFile) {
		this.sourceFile = sourceFile;
	}
}
